﻿using System;

namespace SharpTrainer
{
    public class SortUtil
    {
        public static void BubbleSort(int[] arr)
        {
            int i, j;

            for (i = 0; i < arr.Length; i++)
                for (j = i + 1; j < arr.Length; j++)
                    if (arr[j] < arr[i])
                        swap(ref arr[j], ref arr[i]);
        }

        public static void swap(ref int first, ref int second)
        {
            int temp = first;
            first = second;
            second = temp;
        }
    }
}
